import { uiProperties, uiStyleProperties } from './common'

// timePicker
export const timePickerProperties = [
    ...uiProperties.filter(e => ['ui.placeholder', 'ui.clearable', 'ui.readonly'].indexOf(e.model) !== -1),
    ...uiStyleProperties.filter(e => ['ui.style.width'].indexOf(e.model) !== -1),
    {
        model: 'ui.editable',
        widget: 'switch',
        label: '可输入'
    },
    {
        model: 'ui.valueFormat',
        widget: 'select',
        label: (h) => {
            return (
                <span>绑定值格式 (可输入 <a href="https://element.faas.ele.me/#/zh-CN/component/date-picker#ri-qi-ge-shi" target="_blank">详情请见</a>) </span>
            )
        },
        enum: [
            { label: 'HH:mm:ss', value: 'HH:mm:ss' },
            { label: 'HH:mm', value: 'HH:mm' },
            { label: 'HH', value: 'HH' },
            { label: 'mm:ss', value: 'mm:ss' },
            { label: 'mm', value: 'mm' },
            { label: 'ss', value: 'ss' }
        ],
        ui: {
            placeholder: '请选择或输入绑定值格式',
            filterable: true,
            allowCreate: true,
            clearable: true,
            style: {
                width: '100%'
            }
        }
    },
    {
        model: 'ui.isRange',
        widget: 'switch',
        label: '时间范围选择'
    },
    {
        model: 'ui.startPlaceholder',
        widget: 'input',
        label: '开始时间占位符',
        ui: {
            placeholder: '开始时间占位符',
            maxlength: 100
        },
        if (model) {
            return model && model.ui && model.ui.isRange
        }
    },
    {
        model: 'ui.endPlaceholder',
        widget: 'input',
        label: '结束时间占位符',
        ui: {
            placeholder: '结束时间占位符',
            maxlength: 100
        },
        if (model) {
            return model && model.ui && model.ui.isRange
        }
    },
    {
        model: 'ui.rangeSeparator',
        widget: 'input',
        label: '分隔符',
        ui: {
            placeholder: '分隔符',
            maxlength: 10,
            clearable: true
        },
        if (model) {
            return model && model.ui && model.ui.isRange
        }
    },
    {
        model: 'ui.arrowControl',
        widget: 'switch',
        label: '可箭头选择时间'
    }
    // ,
    // {
    //     model: 'ui.align',
    //     widget: 'radioButton',
    //     label: '对齐方式',
    //     enum: [
    //         { label: 'left', value: '左' },
    //         { label: 'center', value: '中' },
    //         { label: 'right', value: '右' }
    //     ]
    // }
]
